//用户接口
import url from "@/url.config"
import {request} from "../service"

export default ({
                    service,
                    request,
                    tools
                }) => ({
    userRecord(data) {
        //人员签到列表
        return request({
            url: url.ip2 + "/user/signRecord",
            method: "post",
            data: data,
        })
    },
    // 角色分页查询
    postRoleFindByPage(data) {
        return request({
            url: url.ip2 + "/role/findByPage",
            method: "post",
            data: data
        })
    },
    // 角色添加
    postRoleSave(data) {
        return request({
            url: url.ip2 + "/role/save",
            method: "post",
            data: data
        })
    },
    // 修改角色
    postRoleEdit(data) {
        return request({
            url: url.ip2 + "/role/edit",
            method: "put",
            data: data
        })
    },
    // 删除角色
    delRoleRemove(id) {
        return request({
            url: url.ip2 + `/role/remove/${id}`,
            method: "delete"
        })
    },
    // 角色绑定菜单
    postRoleRoleBindMenu(id, data) {
        return request({
            url: url.ip2 + "/role/roleBindMenu?roleId=" + id,
            method: "post",
            data: data
        })
    },
    // 根据角色id获取菜单信息
    MenuFindMenuAndIdByRoleId(id) {
        return request({
            url: url.ip2 + `/menu/findMenuByRoleId/${id}`,
            method: "get"
        })
    },
    // 根据角色id分页查询用户列表
    UserFindUserByRoleId(data) {
        return request({
            url: url.ip2 + "/user/findUserByRoleId",
            method: "post",
            data: data
        })
    },
    // 根据运维点id获取公司信息
    CompanyFindCompanyByPointId(id) {
        return request({
            url: url.ip2 + `/company/findCompanyByPointId/${id}`,
            method: "get"
        })
    },
    // 获取当前用户的所绑定的所有设备id与名称
    equipmentGetEquipmentIdByUserId(data) {
        return request({
            url: url.ip3 + "/monitor/findBindMonitorByUserId",
            method: "post",
            data:data
        })
    },
    // 获取所有排口名称
    getFindMonitorInfoByUserId() {
        return request({
            url: url.ip3 + "/monitor/findMonitorInfoByUserId",
            method: "post",
        })
    },
    // 用户修改绑定的设备
    monitorUserBindMonitor(data) {
        return request({
            url: url.ip2 + "/user/userBindMonitor",
            method: "post",
            data: data
        })
    },
    //根据监测站点id获取该运维部下面的人员信息
    getUserInfoByMonitorId(data, id) {
        return request({
            url: url.ip2 + '/user/getUserInfoByMonitorId/' + id,
            method: "post",
            data: data
        })
    },

    // 根据用户ID查询绑定的角色
    roleFindRoleByUserId(userId) {
        return request({
            url: url.ip2 + `/role/findRoleByUserId/${userId}`,
            method: "get"
        })
    },
    //  新修改用户绑定的角色
    roleUserBindRole(userId, data) {
        return request({
            url: url.ip2 + `/role/userBindRole/${userId}`,
            method: "post",
            data: data
        })
    }
})